import { getBannerList, getProList } from '../../api/home'

export default {
  namespaced: true,
  state: {
    bannerList: [],
    proList: []
  },
  actions: {
    getBannerListAction (context) {
      getBannerList().then(res => {
        context.commit({
          type: 'changeBannerList',
          payload: res.data.data
        })
      })
    },
    getProListAction ({ commit }) {
      getProList().then(res => {
        commit('changeProList', res.data.data)
      })
    }
  },
  mutations: {
    changeBannerList (state, action) {
      state.bannerList = action.payload
    },
    changeProList (state, payload) {
      state.proList = payload
    }
  }
}
